package com.lib.utils;

import com.lib.common.bean.BaseResp;

/**
 * @author FengLing
 * Created on 2017-07-03 16:23
 */
public class MockDataUtils {

    private MockDataUtils() {

    }

    public static BaseResp getMockData(String url, Class<?> clz) {

        if (clz == null || clz == String.class) {
            return new BaseResp("", BaseResp.DATA_OK, getJsonString(url));
        }
        BaseResp baseResp = (BaseResp) JSONUtils.parseObject(getJsonString(url), clz);
        if (baseResp == null) {
            throw new NullPointerException("666 MockDataUtils 模拟数据失败 !");
        }
        baseResp.setUrl(url);
        return baseResp;
    }

    private static String getJsonString(String url) {

        switch (url) {
            case "0":
                return "";
        }
        return "";
    }
}